package sifeap.bl.ejb.usuarios;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import sifeap.dal.ejb.usuarios.RolDALLocal;
import sifeap.entities.usuarios.Rol;
import sifeap.exception.SifeapException;

/**
 * Session Bean implementation class EventoBL
 */
@Stateless(name="RolBL")
public class RolBL implements RolBLLocal {

	@EJB
	private RolDALLocal rolDAL;
	
    /**
     * Default constructor. 
     */
    public RolBL() {}

	@Override
	public boolean crear(Rol rol) throws SifeapException {
		try{
			rolDAL.crear(rol);
			return true;
		}catch (Exception e) {
			throw new SifeapException(e);
		}
	}

	@Override
	public List<Rol> buscarTodos() throws SifeapException {
		try{
			return rolDAL.buscarTodos();
		}catch (Exception e) {
			throw new SifeapException(e);
		}
	}

	@Override
	public boolean modificar(Rol rol) throws SifeapException {
		try {
			rolDAL.modificar(rol);
			return true;
		} catch (Exception e) {
			throw new SifeapException(e);
		}
	}

	@Override
	public boolean eliminar(Rol rol) throws SifeapException {
		try {
			rolDAL.eliminar(rol);
			return true;
		} catch (Exception e) {
			throw new SifeapException(e);
		}
	}

	@Override
	public Rol buscar(Object id) throws SifeapException {
		try {
			Rol rol = rolDAL.buscar(id);
			return rol;
		} catch (Exception e) {
			throw new SifeapException(e);
		}
	}
	
	@Override
	public boolean remover(Rol rol) throws SifeapException {
		try {
			rolDAL.remover(rol);
			return true;
		} catch (Exception e) {
			throw new SifeapException(e);
		}
	}
}